package com.yang.leather.mall.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.yang.leather.admin.pojo.Product;
import com.yang.leather.admin.service.IProdService;
import com.yang.leather.common.struts2.ContextPvd;

@Scope("prototype")
@Controller("mall.index")
public class IndexAction extends MallBaseAction{

	private static final long serialVersionUID = 1L;
	
	private IProdService prodService;
	
	private ContextPvd contextPvd;
	
	public String index(){
		Map<String,String> params = new HashMap<String,String>();
		List<Product> lstProduct = this.prodService.getLimitProdList(params, 8);
		this.getRequest().setAttribute("lstProduct", lstProduct);
		
		this.loadCommonInfo();
		
		this.getRequest().setAttribute("menuSelect", "index");
		
		return SUCCESS;
	}
	
	public IProdService getProdService() {
		return prodService;
	}

	@Autowired
	public void setProdService(@Qualifier("prodService")
			IProdService prodService) {
		this.prodService = prodService;
	}
	
	public ContextPvd getContextPvd() {
		return contextPvd;
	}

	@Autowired
	public void setContextPvd(@Qualifier("contextPvd")
			ContextPvd contextPvd) {
		this.contextPvd = contextPvd;
	}
}
